package com.jstide.credit.data.service.biz;

import cn.hutool.core.util.StrUtil;
import cn.hutool.db.Entity;
import com.jstide.credit.data.service.Algorithm;
import lombok.Getter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;
import java.util.Optional;

public class Factor5 extends Algorithm {

    private static final Logger logger = LoggerFactory.getLogger(Factor5.class);

    @Getter
    public final  String name="5";

    //婚姻信息 登记类别
    //判断是否已婚，满足则给分
    //10
    @Getter
    public  final String sql =" select DJLB from  ZRRHYDJXX where  join_id=@joinId   ";
    @Getter
    public final int defaultScore=10;

    @Override
    public int translate(String rs) {
        return 0;
    }

    @Override
    public int translate(List<Entity> rs) {
         if(null!=rs && rs.size()>0) {
             long count= rs.stream()
                     .filter(t -> (StrUtil.equals("结婚",t.getStr("DJLB"))))
                     .count();
             return count>0?defaultScore:0;
         }
         return 0;
    }

}
